package org.grow.enter.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.Random;

/**
 * @Author: xwg
 * @CreateDate: 2021/9/7
 */

@Component
//@Controller
//@Service
//@Repository
public class Access {

// 构造函数无参数
    @Value("${content}")
    private String content ;

   @Value("${myname}")
    private String bridge;

//   private Random random = new Random();
//
@Autowired
   private Random random;

//    @Value("${content}")


//    public Access(String content) {
//        this.content = content;
//    }

//    public Access() {
//    }
// Spring容器不建议大家使用原生java构造函数 推荐使用Spring容器自己的构造函数
    @PostConstruct
    public void initSpring(){
        System.out.println("====构造函数=====");
    }
    public Integer show(){
        System.out.println("========dao");
        System.out.println("========dao");
        System.out.println("======"+content+"=dao");
        System.out.println("======"+bridge+"=====");
        for (int i = 0; i < 4; i++) {
            System.out.println("======"+random.nextInt(10)+"=====");
        }


        System.out.println("========dao");
        System.out.println("========dao");
        return 10;
    }
}
